<input type="hidden" value="LISTE" name="site[<?PHP echo $nb;?>]<?PHP if(isset($voxbloc)) echo '[bloc]['.$voxbloc.']';?>[question][<?PHP echo $question['id_question'];?>][type]" />
<div class="input_liste" style="clear:both;"><?PHP 
	$options = array();
foreach(($questionscombos[$question['id_question']]['result']) as $ligne) {
	$options[] = ($ligne['reponses']);
}
?>

	<label><?PHP echo $question['libelle_question'];?></label>
	<select onchange="appliquerMoteur(<?PHP echo $nb;?>)" name="site[<?PHP echo $nb;?>]<?PHP if(isset($voxbloc)) echo '[bloc]['.$voxbloc.']';?>[question][<?PHP echo $question['id_question'];?>][val]" 
			<?PHP echo  "id=\"SitesQuestion[".$nb."][".$question['id_question']."][art]\""?>>
			
	<option value="0">Selectionnez une réponse ...</option>
		<?PHP
			// création du script pour ajouter les réponses à la base de fait
			$script = '';
			// ajout des réponses
			foreach($options as $ligne) {
				echo "<option id=\"site".$nb."_reponse_".$ligne['id_reponse']."\" value=\"".$ligne['id_reponse']."\">".$ligne['libelle_reponse_combo']."</option>";
				$script .= "ajouterFait(".$nb.", 'site".$nb."_reponse_".$ligne['id_reponse']."', document.getElementById('site".$nb."_reponse_".$ligne['id_reponse']."'));\n";
				$script .= "baseDeFait[$nb]['site".$nb."_question_".$question['id_question']."_reponses'].push(document.getElementById('site".$nb."_reponse_".$ligne['id_reponse']."'));\n";
			}
		?>
	</select>
</div>

<script type="text/javascript">
	<?PHP echo $script; ?>
	<?PHP
		foreach($question['reponses'] as $reponse) {
			foreach ($reponse['actions'] as $action) {
				// si l'action revient à activer une question
				if($action['id_reponse'] != null) {
					if($action['active_question'] == true) {
						// on ajoute alors deux règles : l'activation de la question lors du checked, et la desactivation sinon
	?>
		ajouterRegle(function() {return $(baseDeFait[<?PHP echo $nb;?>]['site'+<?PHP echo $nb;?>+'_question_'+<?PHP echo $question['id_question']; ?>]).is(':visible') && baseDeFait[<?PHP echo $nb;?>]['site'+<?PHP echo $nb;?>+'_reponse_'+<?PHP echo $reponse['id_reponse']; ?>].selected;}, function() {afficherElement(<?PHP echo $nb;?>, 'site'+<?PHP echo $nb;?>+'_question_'+<?PHP echo $action['id_question']; ?>);});
	<?PHP
					}
					// si l'action revient à desactiver une question
					else if($action['active_question'] == false){
	?>
		ajouterRegle(function() {return $(baseDeFait[<?PHP echo $nb;?>]['site'+<?PHP echo $nb;?>+'_question_'+<?PHP echo $question['id_question']; ?>]).is(':visible') && baseDeFait[<?PHP echo $nb;?>]['site'+<?PHP echo $nb;?>+'_reponse_'+<?PHP echo $reponse['id_reponse']; ?>].selected;}, function() {cacherElement(<?PHP echo $nb;?>, 'site'+<?PHP echo $nb;?>+'_question_'+<?PHP echo $action['id_question']; ?>);});
	<?PHP
					}
				}
			}
			// on parcours également son tableau de change_statut
			foreach($reponse['change_statut'] as $change_statut) {
				// on ajoute au script le changement de statut
				echo "ajouterRegle(function(){return $(baseDeFait[$nb]['site'+$nb+'_question_'+".$question['id_question']."]).is(':visible') && baseDeFait[$nb]['site'+$nb+'_reponse_'+".$reponse['id_reponse']."].selected;}, function(){changerStatut(".$nb.", 'site".$nb."_reponse_".$change_statut['id_reponse_statut_change_par']."', '".$change_statut['libelle_statut']."', ".$change_statut['priorite'].");});\n";
			}
		}
	?>
</script>